var app = getApp();

Page({
  data: {
    list:[],
    page:0,
    keyword:"",
  },
  serchShop:function(e){
    console.log(e.detail.value)
    var name=e.detail.value
    this.setData({
      keyword:name,
      page:0,
      list:[]
    })
    this.getGoods();
  },

  shopdetail: function(e) {
    var that = this
    console.log(that.data.type)
    if (that.data.type == 1) {
      console.log(that.data.type)
      var pages = getCurrentPages();
      var prevPage = pages[pages.length - 2];
      prevPage.setData({
        state: 1
      })
      wx.navigateBack({
        detail: 1
      })
    } else {
      // wx.navigateTo({
      //   url: '/hyb_yl/onesubpages/pages/shopdetail/shopdetail',
      // })
    }
  },
  onLoad: function(options) {
    var that = this;
    that.getGoods();
    
  },
  getGoods:function(){
    var that = this;
    app.util.request({
      'url':"entry/wxapp/regin.goods",
      data:{
        openid:wx.getStorageSync('openid'),
        page:that.data.page,
        keyword:that.data.keyword
      },
      success:function(res){
        var page = that.data.page + 1;
        that.setData({
          list:that.data.list.concat(res.data),
          page:page
        })
      }
    })
  },
  onReady: function() {
  },
  onShow: function() {},
  onHide: function() {},
  onUnload: function() {},
  onPullDownRefresh: function() {},
  onReachBottom: function() {},
  onShareAppMessage: function() {},
  

});